package com.cj.mobile.iabp.mvp.ui.activity;

import static com.jess.arms.utils.Preconditions.checkNotNull;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;

import com.afollestad.materialdialogs.MaterialDialog;
import com.blankj.utilcode.util.ActivityUtils;
import com.cj.mobile.iabp.R;
import com.cj.mobile.iabp.app.dialog.PopupTipsDialog;
import com.cj.mobile.iabp.app.utils.CommonUtils;
import com.cj.mobile.iabp.di.component.DaggerPatientInfoComponent;
import com.cj.mobile.iabp.mvp.contract.PatientInfoContract;
import com.cj.mobile.iabp.mvp.model.entity.ArchiveInfo;
import com.cj.mobile.iabp.mvp.model.entity.PatientDetail;
import com.cj.mobile.iabp.mvp.model.entity.PatientInfo;
import com.cj.mobile.iabp.mvp.model.entity.RemoveInfo;
import com.cj.mobile.iabp.mvp.model.entity.RoundsInfo;
import com.cj.mobile.iabp.mvp.model.entity.SurgeryInfo;
import com.cj.mobile.iabp.mvp.presenter.PatientInfoPresenter;
import com.cj.mobile.iabp.mvp.ui.adapter.RoundsInfoAdapter;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;

import java.util.List;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created on 2025/09/24 22:22
 * 患者信息
 *
 * @author Love_xie
 * module name is PatientInfoActivity
 */
public class PatientInfoActivity extends BaseActivity<PatientInfoPresenter> implements PatientInfoContract.View {
    /*----------------------------------------------------------------控件信息----------------------------------------------------------------*/
    @BindView(R.id.txvi_patientinfo_basic_campus)
    TextView txviBasicCampus;                                                                       // 基本信息 - 院区
    @BindView(R.id.txvi_patientinfo_basic_install)
    TextView txviBasicInstall;                                                                      // 基本信息 - 安装次数
    @BindView(R.id.txvi_patientinfo_basic_code)
    TextView txviBasicCode;                                                                         // 基本信息 - 登记号
    @BindView(R.id.txvi_patientinfo_basic_name)
    TextView txviBasicName;                                                                         // 基本信息 - 患者姓名
    @BindView(R.id.txvi_patientinfo_basic_height)
    TextView txviBasicHeight;                                                                       // 基本信息 - 身高
    @BindView(R.id.txvi_patientinfo_basic_weight)
    TextView txviBasicWeight;                                                                       // 基本信息 - 体重
    @BindView(R.id.txvi_patientinfo_basic_pd)
    TextView txviBasicPrimaryDiagnosis;                                                             // 基本信息 - 主要诊断
    @BindView(R.id.txvi_patientinfo_basic_update)
    TextView txviBasicUpdate;


    @BindView(R.id.btn_patientinfo_surgery_input)
    Button btnSurgeryInput;
    @BindView(R.id.cola_patientinfo_surgery)
    ConstraintLayout colaSurgery;
    @BindView(R.id.txvi_patientinfo_surgery_name)
    TextView txviSurgeryName;                                                                       // 手术信息 - 手术名称
    @BindView(R.id.txvi_patientinfo_surgery_time)
    TextView txviSurgeryTime;                                                                       // 手术信息 - 手术时间
    @BindView(R.id.txvi_patientinfo_surgery_installation)
    TextView txviInstallTime;                                                                       // 手术信息 - 安装时间
    @BindView(R.id.txvi_patientinfo_surgery_update)
    TextView txviSurgeryUpdate;                                                                     // 手术信息 - 修改or暂存


    @BindView(R.id.lila_patientinfo_rounds_content)
    LinearLayout lilaRounds;
    @BindView(R.id.revi_patientinfo_rounds_content)
    RecyclerView reviRounds;


    @BindView(R.id.btn_patientinfo_cheji_input)
    Button btnChejiInput;
    @BindView(R.id.cola_patientinfo_cheji)
    ConstraintLayout colaCheji;
    @BindView(R.id.txvi_patientinfo_cheji_cc)
    TextView txviChejiCC;                                                                           // 撤机信息 - 撤除
    @BindView(R.id.txvi_patientinfo_cheji_concern)
    TextView txviChejiConcern;                                                                      // 撤机信息 - 是否关注
    @BindView(R.id.txvi_patientinfo_cheji_time)
    TextView txviChejiTime;                                                                         // 撤机信息 - 撤除时间
    @BindView(R.id.txvi_patientinfo_cheji_yxtime)
    TextView txviYxTime;                                                                            // 撤机信息 - 运行时间

    @BindView(R.id.cola_patientinfo_wa)
    ConstraintLayout colaWa;
    @BindView(R.id.cola_patientinfo_remove)
    ConstraintLayout colaRemove;
    @BindView(R.id.btn_patientinfo_wa_input)
    Button btnWaInput;
    @BindView(R.id.txvi_patientinfo_wa_ast)
    TextView txviWaAst;                                                                             // 撤机信息 - AST
    @BindView(R.id.txvi_patientinfo_wa_alt)
    TextView txviWaAlt;                                                                             // 撤机信息 - ALT
    @BindView(R.id.txvi_patientinfo_wa_jg)
    TextView txviWaJg;                                                                              // 撤机信息 - 肌酐
    @BindView(R.id.txvi_patientinfo_wa_egfr)
    TextView txviWaEgfr;                                                                            // 撤机信息 - eGFR
    @BindView(R.id.txvi_patientinfo_cheji_update)
    TextView txviChejiUpdate;
    @BindView(R.id.txvi_patientinfo_wa_update)
    TextView txviWaUpdate;


    @BindView(R.id.btn_patientinfo_pigeonhole_input)
    Button btnPigeonholeInput;
    @BindView(R.id.cola_patientinfo_pigeonhole)
    ConstraintLayout colaPigeonhole;
    @BindView(R.id.txvi_patientinfo_pigeonhole_state)
    TextView txviPigeonholeState;                                                                   // 归档信息 - 状态
    @BindView(R.id.txvi_patientinfo_pigeonhole_calvin)
    TextView txviPigeonholeCalvin;                                                                   // 归档信息 - 出院前肌钙蛋白
    @BindView(R.id.txvi_patientinfo_pigeonhole_volume)
    TextView txviPigeonholeVolume;                                                                   // 归档信息 - 出院前左室舒张末期容积
    @BindView(R.id.txvi_patientinfo_pigeonhole_fraction)
    TextView txviPigeonholeFraction;                                                                   // 归档信息 - 出院前左室射血分数
    @BindView(R.id.txvi_patientinfo_pigeonhole_update)
    TextView txviPigeonholeUpdate;

    /*----------------------------------------------------------------业务信息----------------------------------------------------------------*/
    @Inject
    RecyclerView.LayoutManager mLayoutManager;

    @Inject
    RoundsInfoAdapter mAdapter;

    @Inject
    List<RoundsInfo> roundsList;

    // 患者基本信息数据源
    private PatientInfo mPatientInfo;
    // 手术信息数据源
    private SurgeryInfo mSurgeryInfo;
    // 撤机信息数据源
    private RemoveInfo mRemoveInfo;
    // 归档信息数据源
    private ArchiveInfo mArchiveInfo;


    /**
     * 对话框
     */
    private MaterialDialog mDialog;

    @Override
    public void onDestroy() {
        // super.onDestroy()之后会unbind,所有view被置为null,所以必须在之前调用
        DefaultAdapter.releaseAllHolder(reviRounds);
        if (mDialog != null) {
            this.mDialog.dismiss();
        }
        super.onDestroy();
        this.mDialog = null;

        this.mLayoutManager = null;
        this.mAdapter = null;
        this.roundsList = null;
    }

    @Override
    protected void onResume() {
        super.onResume();

        if (mPresenter != null) {
            mPresenter.initData();
        }
    }

    /**
     * 根据主题使用不同的颜色。
     * 如果想要纯透明，则需要重写此方法，返回值为 -1 即可。
     */
    public int useStatusBarColor() {
        TypedValue typedValue = new TypedValue();
        getTheme().resolveAttribute(android.R.color.white, typedValue, true);
        return typedValue.data;
    }

    /**
     * 将状态栏改为浅色模式(状态栏 icon 和字体会变成深色)
     */
    public boolean useLightStatusBar() {
        return true;
    }

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerPatientInfoComponent
                .builder()
                .appComponent(appComponent)
                .view(this)
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_patient_info;
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        // 设置标题
        setTitle("患者信息");

        // 初始化Loading对话框
        mDialog = new MaterialDialog.Builder(this).content(R.string.common_execute).progress(true, 0).cancelable(false).build();


        if (mPresenter != null) {
            mPresenter.getBundleValues(getIntent().getExtras());
        }

        initRecyclerView();
    }

    @OnClick({
            R.id.lila_patientinfo_basic_select,                                                     // 基本信息 - 查看
            R.id.lila_patientinfo_basic_update,                                                     // 基本信息 - 修改

            R.id.btn_patientinfo_surgery_input,                                                     // 手术信息 - 录入
            R.id.lila_patientinfo_surgery_select,                                                   // 手术信息 - 查看
            R.id.lila_patientinfo_surgery_update,                                                   // 手术信息 - 修改

            R.id.btn_patientinfo_rounds_input,                                                      // 查房信息 - 录入

            R.id.btn_patientinfo_cheji_input,                                                       // 撤机信息 - 录入
            R.id.lila_patientinfo_cheji_select,                                                     // 撤机信息 - 查看
            R.id.lila_patientinfo_cheji_update,                                                     // 撤机信息 - 修改

            R.id.btn_patientinfo_wa_input,                                                          // 撤机关注信息 - 录入
            R.id.lila_patientinfo_wa_select,                                                        // 撤机关注信息 - 查看
            R.id.lila_patientinfo_wa_update,                                                        // 撤机关注信息 - 修改

            R.id.btn_patientinfo_pigeonhole_input,                                                  // 归档信息 - 录入
            R.id.lila_patientinfo_pigeonhole_select,                                                // 归档信息 - 查看
            R.id.lila_patientinfo_pigeonhole_update,                                                // 归档信息 - 修改
    })
    @Override
    public void onClick(View v) {
        if (mPatientInfo == null) {
            showMessage("未获取患者信息，请联系管理员！");
            return;
        }

        Bundle mBundle = new Bundle();
        mBundle.putString("id", mPatientInfo.getId());
        mBundle.putString("code", mPatientInfo.getCode());
        mBundle.putString("name", mPatientInfo.getName());

        switch (v.getId()) {
            case R.id.lila_patientinfo_basic_select:                                                // 基本信息 - 查看
                mBundle.putParcelable("info", mPatientInfo);
                ActivityUtils.startActivity(mBundle, PatientBasicInfoActivity.class);
                break;
            case R.id.lila_patientinfo_basic_update:                                                // 基本信息 - 修改
                mBundle.putParcelable("info", mPatientInfo);
                ActivityUtils.startActivity(mBundle, AddPatientActivity.class);
                break;
            case R.id.btn_patientinfo_surgery_input:                                                // 手术信息 - 录入
                mBundle.putString("deptId", mPatientInfo.getDeptId());
                mBundle.putString("deptSec", mPatientInfo.getDeptSec());
                ActivityUtils.startActivity(mBundle, AddSurgeryInfoActivity.class);
                break;
            case R.id.lila_patientinfo_surgery_select:                                              // 手术信息 - 查看
                if (mSurgeryInfo != null)
                    mBundle.putParcelable("info", mSurgeryInfo);
                ActivityUtils.startActivity(mBundle, SurgeryInfoActivity.class);
                break;
            case R.id.lila_patientinfo_surgery_update:                                              // 手术信息 - 修改
                mBundle.putString("deptId", mPatientInfo.getDeptId());
                mBundle.putString("deptSec", mPatientInfo.getDeptSec());
                if (mSurgeryInfo != null)
                    mBundle.putParcelable("info", mSurgeryInfo);
                ActivityUtils.startActivity(mBundle, AddSurgeryInfoActivity.class);
                break;

            case R.id.btn_patientinfo_rounds_input:                                                 // 查房信息 - 录入
                mBundle.putString("area", mPatientInfo.getArea());
                mBundle.putString("bedNo", mPatientInfo.getBedNo());
                if (mSurgeryInfo != null)
                    mBundle.putString("machineCode", mSurgeryInfo.getMachineCode());
                ActivityUtils.startActivity(mBundle, AddRoundsInfoActivity.class);
                break;

            case R.id.btn_patientinfo_cheji_input:                                                  // 撤机信息 - 录入
                // 增加一个判断，如果没有手术信息，则不让录入撤机信息
                if (mSurgeryInfo == null) {
                    showMessage("请填写手术信息！");
                    return;
                }

                mBundle.putString("doctorId", mPatientInfo.getDoctorId());
                mBundle.putString("deptId", mPatientInfo.getDeptId());
                mBundle.putString("deptSec", mPatientInfo.getDeptSec());
                ActivityUtils.startActivity(mBundle, AddRemoveInfoActivity.class);
                break;
            case R.id.lila_patientinfo_cheji_select:                                                // 撤机信息 - 查看
                if (mRemoveInfo != null)
                    mBundle.putParcelable("info", mRemoveInfo);
                ActivityUtils.startActivity(mBundle, RemoveInfoActivity.class);
                break;
            case R.id.lila_patientinfo_cheji_update:                                                // 撤机信息 - 修改
                mBundle.putString("doctorId", mPatientInfo.getDoctorId());
                mBundle.putString("deptId", mPatientInfo.getDeptId());
                mBundle.putString("deptSec", mPatientInfo.getDeptSec());
                if (mRemoveInfo != null)
                    mBundle.putParcelable("info", mRemoveInfo);
                ActivityUtils.startActivity(mBundle, AddRemoveInfoActivity.class);
                break;

            case R.id.btn_patientinfo_wa_input:                                                     // 撤机关注信息 - 录入
                if (mRemoveInfo != null)
                    mBundle.putParcelable("info", mRemoveInfo);
                ActivityUtils.startActivity(mBundle, AddRemoveConcernInfoActivity.class);
                break;
            case R.id.lila_patientinfo_wa_select:                                                   // 撤机关注信息 - 查看
                if (mRemoveInfo != null)
                    mBundle.putParcelable("info", mRemoveInfo);
                ActivityUtils.startActivity(mBundle, RemoveConcernInfoActivity.class);
                break;
            case R.id.lila_patientinfo_wa_update:                                                   // 撤机关注信息 - 修改
                if (mRemoveInfo != null)
                    mBundle.putParcelable("info", mRemoveInfo);
                ActivityUtils.startActivity(mBundle, AddRemoveConcernInfoActivity.class);
                break;

            case R.id.btn_patientinfo_pigeonhole_input:                                             // 归档信息 - 录入
                if (mRemoveInfo == null) {
                    showMessage("请填写撤机信息！");
                    return;
                }
                mBundle.putString("doctorId", mPatientInfo.getDoctorId());
                mBundle.putString("deptId", mPatientInfo.getDeptId());
                ActivityUtils.startActivity(mBundle, AddArchiveInfoActivity.class);
                break;
            case R.id.lila_patientinfo_pigeonhole_select:                                           // 归档信息 - 查看
                if (mArchiveInfo != null)
                    mBundle.putParcelable("info", mArchiveInfo);
                ActivityUtils.startActivity(mBundle, ArchiveInfoActivity.class);
                break;
            case R.id.lila_patientinfo_pigeonhole_update:                                           // 归档信息 - 修改
                mBundle.putString("doctorId", mPatientInfo.getDoctorId());
                mBundle.putString("deptId", mPatientInfo.getDeptId());
                if (mArchiveInfo != null)
                    mBundle.putParcelable("info", mArchiveInfo);
                ActivityUtils.startActivity(mBundle, AddArchiveInfoActivity.class);
                break;
        }
    }

    /**
     * 初始化RecyclerView
     */
    private void initRecyclerView() {
        ArmsUtils.configRecyclerView(reviRounds, mLayoutManager);
        reviRounds.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener((view, viewType, data, position) -> {
            RoundsInfo info = (RoundsInfo) data;
            Bundle mBundle = new Bundle();

            if (view.getId() == R.id.tv_rounds_select) {
                // 查看
                mBundle.putString("name", mPatientInfo.getName());
                mBundle.putParcelable("info", info);
                ActivityUtils.startActivity(mBundle, RoundsInfoActivity.class);
            } else if (view.getId() == R.id.tv_rounds_update) {
                // 修改
                mBundle.putString("id", info.getPatienId());
                mBundle.putString("code", mPatientInfo.getCode());
                mBundle.putString("name", mPatientInfo.getName());
                mBundle.putString("area", info.getRoomCode());
                mBundle.putString("bedNo", info.getBedCode());
                mBundle.putParcelable("info", info);
                if (mSurgeryInfo != null)
                    mBundle.putString("machineCode", mSurgeryInfo.getMachineCode());
                ActivityUtils.startActivity(mBundle, AddRoundsInfoActivity.class);
            } else if (view.getId() == R.id.tv_rounds_del) {
                // 删除
                PopupTipsDialog dialog = new PopupTipsDialog(this, "是否删除【" + info.getDoctorName() + "】查房信息？", click -> {
                    if (click) {
                        if (mPresenter != null) {
                            mPresenter.removeRounds(info.getId());
                        }
                    }
                });
                dialog.showAtLocation(view, Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0);

            }
        });
    }

    @Override
    public Activity getActivity() {
        return this;
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @Override
    public void loadPatientDetail(PatientDetail info) {
        if (info != null) {
            mPatientInfo = info.getPatient();
            mSurgeryInfo = info.getSurgery();
            mRemoveInfo = info.getRemove();
            mArchiveInfo = info.getArchive();

            // 基本信息
            if (info.getPatient() != null) {
                txviBasicCampus.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getSecName()));
                txviBasicInstall.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getCnt()));
                txviBasicCode.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getCode()));
                txviBasicName.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getName()));
                txviBasicHeight.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getHeight()));
                txviBasicWeight.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getWeight()));
                txviBasicPrimaryDiagnosis.setText(CommonUtils.isEmptyReturnStr(info.getPatient().getDiagnoseF()));

                if (!TextUtils.isEmpty(info.getPatient().getPer()))
                    if (info.getPatient().getPer().equals("1")) {
                        txviBasicUpdate.setText("修改");
                        txviBasicUpdate.setTextColor(getResources().getColor(R.color.text_h_bg_color));
                    } else {
                        txviBasicUpdate.setText("暂存");
                        txviBasicUpdate.setTextColor(getResources().getColor(R.color.text_l_bg_color));
                    }

            }

            // 手术信息
            if (info.getSurgery() != null) {
                btnSurgeryInput.setVisibility(View.INVISIBLE);
                colaSurgery.setVisibility(View.VISIBLE);

                if (!TextUtils.isEmpty(info.getSurgery().getSurgeryName())) {
                    // 特殊处理：去掉“其他”和特殊字符
                    String result = CommonUtils.dataProcessing(
                            info.getSurgery().getSurgeryName().split(","),
                            "其他(详述)");

                    txviSurgeryName.setText(CommonUtils.isEmptyReturnStr(result));
                }

                txviSurgeryTime.setText(CommonUtils.isEmptyReturnStr(info.getSurgery().getSurgeryTime()));
                txviInstallTime.setText(CommonUtils.isEmptyReturnStr(info.getSurgery().getInstallTime()));

                if (!TextUtils.isEmpty(info.getSurgery().getPer()))
                    if (info.getSurgery().getPer().equals("1")) {
                        txviSurgeryUpdate.setText("修改");
                        txviSurgeryUpdate.setTextColor(getResources().getColor(R.color.text_h_bg_color));
                    } else {
                        txviSurgeryUpdate.setText("暂存");
                        txviSurgeryUpdate.setTextColor(getResources().getColor(R.color.text_l_bg_color));
                    }

            } else {
                btnSurgeryInput.setVisibility(View.VISIBLE);
                colaSurgery.setVisibility(View.GONE);
            }

            // 查房信息
            roundsList.clear();
            if (CommonUtils.isNotEmpty(info.getRounds())) {
                lilaRounds.setVisibility(View.VISIBLE);

                roundsList.addAll(info.getRounds());
                mAdapter.notifyDataSetChanged();
            } else {
                lilaRounds.setVisibility(View.GONE);
            }

            // 撤机信息
            // 撤机关注信息
            if (info.getRemove() != null) {
                btnChejiInput.setVisibility(View.INVISIBLE);
                colaCheji.setVisibility(View.VISIBLE);

                txviChejiCC.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getRemoveType()));
                txviChejiConcern.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getFocuse()));
                txviChejiTime.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getRemoveTime()));
                txviYxTime.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getRunTimeStr()));

                if (!TextUtils.isEmpty(info.getRemove().getPer()))
                    if (info.getRemove().getPer().equals("1")) {
                        txviChejiUpdate.setText("修改");
                        txviChejiUpdate.setTextColor(getResources().getColor(R.color.text_h_bg_color));

                        txviWaUpdate.setText("修改");
                        txviWaUpdate.setTextColor(getResources().getColor(R.color.text_h_bg_color));
                    } else {
                        txviChejiUpdate.setText("暂存");
                        txviChejiUpdate.setTextColor(getResources().getColor(R.color.text_l_bg_color));

                        txviWaUpdate.setText("暂存");
                        txviWaUpdate.setTextColor(getResources().getColor(R.color.text_l_bg_color));
                    }

                if (info.getRemove().getFocuse() != null && info.getRemove().getFocuse().equals("是")) {
                    colaWa.setVisibility(View.VISIBLE);
                } else {
                    colaWa.setVisibility(View.GONE);
                }
                txviWaAst.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getAst(), "暂无"));
                txviWaAlt.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getAlt(), "暂无"));
                txviWaJg.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getCr(), "暂无"));
                txviWaEgfr.setText(CommonUtils.isEmptyReturnStr(info.getRemove().getEgfr(), "暂无"));

                btnWaInput.setVisibility(
                        TextUtils.isEmpty(info.getRemove().getAst()) &&
                                TextUtils.isEmpty(info.getRemove().getAlt()) &&
                                TextUtils.isEmpty(info.getRemove().getCr()) &&
                                TextUtils.isEmpty(info.getRemove().getEgfr())
                                ? View.VISIBLE : View.INVISIBLE);

                colaRemove.setVisibility(
                        TextUtils.isEmpty(info.getRemove().getAst()) &&
                                TextUtils.isEmpty(info.getRemove().getAlt()) &&
                                TextUtils.isEmpty(info.getRemove().getCr()) &&
                                TextUtils.isEmpty(info.getRemove().getEgfr())
                                ? View.GONE : View.VISIBLE);
            } else {
                btnChejiInput.setVisibility(View.VISIBLE);
                colaCheji.setVisibility(View.GONE);
                colaWa.setVisibility(View.GONE);
            }

            // 档案信息
            if (info.getArchive() != null) {
                btnPigeonholeInput.setVisibility(View.INVISIBLE);
                colaPigeonhole.setVisibility(View.VISIBLE);

                txviPigeonholeState.setText(CommonUtils.isEmptyReturnStr(info.getArchive().getAlive()));
                txviPigeonholeCalvin.setText(CommonUtils.isEmptyReturnStr(info.getArchive().getGa()));
                txviPigeonholeVolume.setText(CommonUtils.isEmptyReturnStr(info.getArchive().getLeftSize()));
                txviPigeonholeFraction.setText(CommonUtils.isEmptyReturnStr(info.getArchive().getLeftScore()));

                if (!TextUtils.isEmpty(info.getArchive().getPer()))
                    if (info.getArchive().getPer().equals("1")) {
                        txviPigeonholeUpdate.setText("修改");
                        txviPigeonholeUpdate.setTextColor(getResources().getColor(R.color.text_h_bg_color));
                    } else {
                        txviPigeonholeUpdate.setText("暂存");
                        txviPigeonholeUpdate.setTextColor(getResources().getColor(R.color.text_l_bg_color));
                    }
            } else {
                btnPigeonholeInput.setVisibility(View.VISIBLE);
                colaPigeonhole.setVisibility(View.GONE);
            }
        }
    }

    @Override
    public void showLoadingSubmit() {
        if (mDialog != null)
            mDialog.show();
    }

    @Override
    public void hideLoadingSubmit() {
        if (mDialog != null)
            mDialog.hide();
    }
}